<?php

namespace app\http\middleware;

class CheckLogin
{
    public function handle($request, \Closure $next)
    {
        if($request->isAjax() && !session('info')){
            return json(['code'=>202,'msg'=>'登录已失效，请重新登录']);
        }
        if(!session('info')) return redirect('/login');
        return $next($request);
    }

}
